using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.Logging.Data.Controllers.Interfaces;
using T2.Logging.Data.Entities.Interfaces;
using T2.Logging.Business.Entities.Interfaces;
using T2.Logging.Business.Entities;
using T2.Logging.Data.Controllers;
using T2.Logging.Business.Builders.Interface;
using T2.Logging.Business.Translators;
using T2.Logging.Business.Entities.Search.Interfaces;
using T2.Logging.Data.Entities.Search.Interfaces;


//--Change Management Control - Application Builder  --**********************
//--Created By: trooks
//--Description: Application Builder Class
//--Created Date: 03/07/2013 10:05:30
//--*************************************************************

namespace T2.Logging.Business.Builders
{
	public partial class Application_Builder : IApplication_builder 
	{
		
	public List<IApplication_biz> BuildParts (IApplication_biz _param)
	{
			IApplication_biz temp = new Application_biz();
			IApplicationController cont = new ApplicationController();
			List<IApplication_biz> tempList = new List<IApplication_biz>();
			List<IApplication> tempData = new List<IApplication>();
			switch (_param.Action)
			{
				case "GetOne":
				temp = ApplicationTranslator.TranslateFromDataLayer(cont.Application_GetOne(ApplicationTranslator.TranslateToDataLayer(_param)));
				tempList.Add(temp);
				return tempList;

				case "GetAll":
				tempData = cont.Application_GetAll(ApplicationTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => ApplicationTranslator.TranslateFromDataLayer(p)).Cast<IApplication_biz>().ToList();
				return tempList;

				case "Tenant_Application_ByParent":
				tempData = cont.Tenant_Application_ByParent(ApplicationTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => ApplicationTranslator.TranslateFromDataLayer(p)).Cast<IApplication_biz>().ToList();
				return tempList;

			}
			return tempList;
}
	public List<IApplication_biz> BuildParts (IApplicationSearch_biz _param)
	{
			IApplication_biz temp = new Application_biz();
			IApplicationController cont = new ApplicationController();
			List<IApplication_biz> tempList = new List<IApplication_biz>();
			List<IApplication> tempData = new List<IApplication>();
			tempData = cont.Application_Search(ApplicationTranslator.TranslateSearchToDataLayer(_param));
			tempList = tempData.Select(p => ApplicationTranslator.TranslateFromDataLayer(p)).Cast<IApplication_biz>().ToList();
			return tempList;

	}
		
	}
}
